package eg.com.itiga.ui.decorators;

import org.displaytag.decorator.TableDecorator;

import eg.com.itiga.domain.Itian;
import eg.com.itiga.domain.ItianCompany;

public class ItianDecorator extends TableDecorator 
{
	public String getCount()
	{
		return "1";
	}
	public String getCurrentCompany()
    {
		String result = "";
        Itian itian = (Itian)getCurrentRowObject();
       
		Object[] companies = itian.getItianCompanies().toArray();
		
		for (int i = 0; i < companies.length; i++) {
			ItianCompany itianCompany = (ItianCompany) companies[i];
			
			if(itianCompany.getIsCurrent())
			{
				result = itianCompany.getCompany().getCName();
				break;
			}
		}

		return result;
    }
	
	public String getDepartment()
    {
		String result = "";
        Itian itian = (Itian)getCurrentRowObject();
       
		return itian.getDepartment().getDName();
    }
}
